package com.shanyin.framework.feign.web;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.shanyin.framework.common.base.ResponseData;
import com.shanyin.framework.feign.service.UserFeignService;

/***
 ** @category 请用一句话来描述其用途...
 ** @author qing.yunhui
 ** @email: 280672161@qq.com
 ** @createTime: 2018年5月30日下午3:52:59
 **/
@RestController
@RequestMapping(UserController.ACTION_PATH)
public class UserController {

	final Logger logger = LoggerFactory.getLogger(getClass());
	
    final static String ACTION_PATH="/feign";
    
    @Autowired
    UserFeignService userFeignService;
	
    @RequestMapping(value = "/login",method=RequestMethod.GET)
    public ResponseData login(@RequestParam("phone")String phone,@RequestParam("password")String password,@RequestParam("isPhone")boolean isPhone) {
    	logger.info("===============>【feign】开始调用登陆接口...");
    	ResponseData responseData=userFeignService.login(phone, password,isPhone);
    	logger.info("===============>【feign】调用登陆接口完毕...");
        return responseData;
    }
    
    @RequestMapping(value = "/registered")
    public ResponseData registered(@RequestParam("phone")String phone,@RequestParam("password")String password,String registerChannel,String invitationCode) {
    	logger.info("===============>【feign】开始调用注册接口...");
    	ResponseData responseData=userFeignService.registered(phone, password, registerChannel, invitationCode);
    	logger.info("===============>【feign】调用注册接口完毕...");
        return responseData;
    }
}
